﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Home.Master" Inherits="System.Web.Mvc.ViewPage<SDT.Site.ViewModels.ProjectIndexModels>" %>
<%@ Import Namespace="SDT.Lib.Paging" %>
<%@ Import Namespace="SDT.Lib.Helpers" %>
<%@ Import Namespace = "SDT.Model" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	<%= Model.Category!=null? Html.Encode(Model.Category.Name): "Dự án bất động sản"%>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<%if (Model.Projects != null && Model.Projects.Count > 0)
  {
      var first = Model.Projects[0]; %> 
    <div class="prj_list">
    <%--<div class="componentheading">
		<h2><%= Model.Category != null ? Html.Encode(Model.Category.Name) : "Dự án bất động sản"%></h2>
	</div>--%>
	<div class="breadcrumbs">
            <a href="/home">Trang chủ</a>
            <span></span>
            <a href="/project">Dự án cùng doanh nghiệp</a>
            <span></span><%=Model.Company!=null?Html.Encode(Model.Company.Name) :string.Empty %>
            <div class="line"></div>
    </div>
    <div class="clear"></div>
    <div class="leading">
        <div class="leading-left">
            <a href="/project/details/<%=first.ID %>/<%=Html.ToUrlFriendly(first.Title)%>">
                <% string imgPath = (first.ImagePath != null && first.ImagePath != string.Empty) ? SDT.Lib.Common.Utils.GenThumbnail(first.ID, 214, 150, first.ImagePath, Model.ImagePath, Model.ImageUrl) : SDT.Lib.Common.Globals.DefaultLogo; %>
                <img src="<%=imgPath %>" title="<%=first.Title %>" alt="<%=first.Title %>" class="bor_img" width="214" height="150" style="overflow:hidden"/>
            </a>
        </div>
        <div class="leading-right">
            <h3>
                <a class="contentpagetitle" href="/project/details/<%=first.ID %>/<%=Html.ToUrlFriendly(first.Title)%>">
                     <%=Html.Encode(first.Title)%> </a>
            </h3>
            <div class="dt">
                <label>Chủ đầu tư</label>
                <%var f = first.ProjectCompanyMaps.Where(e => e.TypeID == SDT.Lib.Common.ProjectCompanyListType.Investors).ToList();
                  if (f.Count > 0)
                  {
                      Response.Write("<span>: " + Html.Encode(f[0].Company.Name) + "</span>");
                  }
                        %>    
            </div>
            <div class="dt">
                <label>Đơn vị giám sát</label>
                    <%var fm = first.ProjectCompanyMaps.Where(e => e.TypeID == SDT.Lib.Common.ProjectCompanyListType.Monitoring).ToList();
                      if (fm.Count > 0)
                      {
                          Response.Write("<span>: " + Html.Encode(fm[0].Company.Name) + "</span>");
                      }
                    %>                        
            </div>
            <div class="dt">
                <label>Địa chỉ</label><span>:&nbsp;<%=Html.Encode(first.Address)%></span>
            </div>            
            <div class="dt">
                <label>Quy mô</label><span>:&nbsp;<%=Html.Encode(first.Scale)%></span>
            </div> 
            <div class="dt">
                <label>Vốn đầu tư</label><span>:&nbsp;<%=Html.Encode(first.Investment)%></span>
            </div>           
        </div>
        <div style="display: block; overflow: hidden; width: 680px;">
            <strong>Mô tả</strong>: <%=Html.Encode(first.Summary)%>
        </div>
    </div>
    <% for (int i = 1; i < Model.Projects.Count; i++)
       {
           string imgPath1 = (Model.Projects[i].ImagePath != null && Model.Projects[i].ImagePath != string.Empty) ? SDT.Lib.Common.Utils.GenThumbnail(Model.Projects[i].ID, 130, 110, Model.Projects[i].ImagePath, Model.ImagePath, Model.ImageUrl) : SDT.Lib.Common.Globals.DefaultLogo;
           %>
        <div class="item">
            <div class="blog-left">
                <a href="/project/details/<%=Model.Projects[i].ID %>/<%=Html.ToUrlFriendly(Model.Projects[i].Title)%>">
                <img class="bor_img" src="<%=imgPath1 %>" title="<%=Model.Projects[i].Title %>" alt="<%=Model.Projects[i].Title %>" width="130" height="110" /></a>
            </div>
            <div class="blog-right">
                <h3>
                    <a href="/project/details/<%=Model.Projects[i].ID %>/<%=Html.ToUrlFriendly(Model.Projects[i].Title)%>">
                        <%=Html.Encode(Model.Projects[i].Title)%>
                    </a>
                </h3>
                <div class="dt">
                    <label>Chủ đầu tư</label>
                        <%var c = Model.Projects[i].ProjectCompanyMaps.Where(e => e.TypeID == SDT.Lib.Common.ProjectCompanyListType.Investors).ToList();
                          if (c.Count > 0)
                          {
                              Response.Write("<span>: " + Html.Encode(c[0].Company.Name) + "</span>");
                          }
                        %>                        
                </div>
                <div class="dt">
                    <label>Đơn vị giám sát</label>
                        <%var m = Model.Projects[i].ProjectCompanyMaps.Where(e => e.TypeID == SDT.Lib.Common.ProjectCompanyListType.Monitoring).ToList();
                          if (m.Count > 0)
                          {
                              Response.Write("<span>: " + Html.Encode(m[0].Company.Name) + "</span>");
                          }
                        %>                        
                </div>
                <div class="dt">
                    <label>Địa chỉ</label><span>:&nbsp;<%=Html.Encode(Model.Projects[i].Address)%></span>
                </div>                
                <div class="dt">
                    <label>Quy mô</label><span>:&nbsp;<%=Html.Encode(Model.Projects[i].Scale)%> </span>
                </div>
                <div class="dt">
                    <label>Vốn đầu tư</label><span><%=": "+Html.Encode(Model.Projects[i].Investment)%></span>
                </div>
            </div>
        </div>
    <%} %>
    
</div>
<div class="pagebarUTH f_r">
    Trang <%= Model.Projects.PageNumber%>/<%= Model.Projects.PageCount%>
    <%= Html.Pager(Model.Projects.PageSize, Model.Projects.PageNumber, Model.Projects.TotalItemCount, new
{
    id = Model.Category != null ? Model.Category.ID : 0,
    cityid = Model.CityID.HasValue ? Model.CityID : 0,
    distrid = Model.DistrictID.HasValue ? Model.DistrictID : 0,
    key = Model.Keyword
})%>
 </div>	
<%}
  else
  { %>
  <div class="noresult">Dữ liệu đang được cập nhật</div>
<%} %>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="RightContent" runat="server">
  <% Html.RenderAction("LastedRightTop", "Banner", new { posid = 5, menuid = 0, number = 0, width = 280, height = 250, order = "Priority", orderDir = "asc" }); %>
  <% Html.RenderAction("Search", "Project", new { id = Model.Category != null ? Model.Category.ID : 0, cityid = Model.CityID, distrid = Model.DistrictID, key=Model.Keyword }); %>
  <div class="clear mar_t"></div>
  <% Html.RenderAction("Lasted", "Video", new { catid = 0, number = 3, title = string.Empty }); %>
  <div class="clear mar_t"></div>
  <% Html.RenderAction("HotByCat", "Project", new {number=3, catid=Model.Category!=null?Model.Category.ID:0,hotYN= 1,pubYN= 1, title = "Dự án nổi bật" , prjorder="ID", prjorderDir="desc" }); %>
  <div class="clear"></div>
   <% Html.RenderAction("Focus", "Article", new { number = 5, skip = 0, catid =0, title = "Tin tiêu điểm", order = "ID", orderDir = "desc" }); %>
  <div class="clear"></div>
  <% Html.RenderAction("Lasted", "Event", new { number = 3, catid =0 }); %>   
   <div class="clear"></div>
   <% Html.RenderAction("NewestByCat", "Article", new { number = 3, skip = 0, catid = SDT.Model.ConfigManager.GetChuyengiaPhantich(), title = "Chuyên gia phân tích", order = "ID", orderDir = "desc" }); %>
   <div class="mar_t">
        <% Html.RenderAction("LastedRightCenter", "Banner", new { posid = 6, menuid = 0, number = 0, width = 280, height = 250, order = "Priority", orderDir = "asc" }); %>
   </div>
   <div class="mar_t">
        <% Html.RenderAction("LastedRightBottom", "Banner", new { posid = 7, menuid = 0, number = 0, width = 280, height = 250, order = "Priority", orderDir = "asc" }); %>
   </div>
</asp:Content>
